<!--
 * @Author: your name
 * @Date: 2022-04-13 09:43:00
 * @LastEditTime: 2022-04-13 09:55:32
 * @LastEditors: your name
 * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 * @FilePath: \geyao\javascript实现继承220413.html
-->
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>实现继承与多态</title>
</head>
<body>
  <script>
    function parentClass() {
      //私人变量
      var x="我是私人变量"
      //私人方法
      function method() {
        console.log("我是私人方法")
      }
      //公共变量
      this.x="我是公共变量"
      //公共方法
      this.method=function() {
        console.log(x)
        console.log(this.x)
        method()
      }
    }
    parentClass.prototype.method1=function() {
      console.log("我是父级的原型方法")
    }
    parentClass.staticMethod=function(){
      console.log("我是父级的静态方法")
    }
  </script>
</body>
</html>